/*
 * @Author: ray
 * @Date:   2019-06-20 19:18:51
 * @Last Modified by:   ray
 * @Last Modified time: 2019-06-20 19:28:00
 */
const path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var webpack = require("webpack");
var globalConfig = require("./globalConfig.json");
module.exports = {
	appConfig: {
		name: "appConfig",
		entry: "./src/index.js",
		output: {
			path: path.join(__dirname, "./dist"),
			filename: "[name].[hash].js",
			chunkFilename: "[name].[chunkhash].js"
			// publicPath: "/"
		},
		devServer: {
			contentBase: path.join(__dirname, "./dist"),
			historyApiFallback: true
		},
		plugins: [
			new HtmlWebpackPlugin({
				filename: "./index.html",
				// chunks: ["app"],
				template: "./src/index.html"
			}),
			new webpack.ProvidePlugin(globalConfig)
		]
	},
	omsConfig: {
		name: "omsConfig",
		entry: "./src/OMS/OMSIndex.js",
		output: {
			path: path.join(__dirname, "./dist"),
			filename: "[name].[hash].js",
			chunkFilename: "[name].[chunkhash].js",
			publicPath: "../"
		},
		devServer: {
			contentBase: path.join(__dirname, "./dist"),
			historyApiFallback: true
		},
		plugins: [
			new HtmlWebpackPlugin({
				filename: "./OMS/index.html",
				// chunks: ["OMS"],
				template: "./src/OMS/OMSIndex.html"
			}),
			new webpack.ProvidePlugin(globalConfig)
		]
	},
	pmConfig: {
		name: "pmConfig",
		entry: "./src/PM/PMIndex.js",
		output: {
			path: path.join(__dirname, "./dist"),
			filename: "[name].[hash].js",
			chunkFilename: "[name].[chunkhash].js",
			publicPath: "../"
		},
		devServer: {
			contentBase: path.join(__dirname, "./dist"),
			historyApiFallback: true
		},
		plugins: [
			new HtmlWebpackPlugin({
				filename: "./PM/index.html",
				// chunks: ["PM"],
				template: "./src/PM/PMIndex.html"
			}),
			new webpack.ProvidePlugin(globalConfig)
		]
	},
	spConfig: {
		name: "spConfig",
		entry: "./src/SP/SPIndex.js",
		output: {
			path: path.join(__dirname, "./dist"),
			filename: "[name].[hash].js",
			chunkFilename: "[name].[chunkhash].js",
			publicPath: "../"
		},
		devServer: {
			contentBase: path.join(__dirname, "./dist"),
			historyApiFallback: true
		},
		plugins: [
			new HtmlWebpackPlugin({
				filename: "./SP/index.html",
				// chunks: ["SP"],
				template: "./src/SP/SPIndex.html"
			}),
			new webpack.ProvidePlugin(globalConfig)
		]
	},
	hmsConfig: {
		name: "hmsConfig",
		entry: "./src/HMS/HMSIndex.js",
		output: {
			path: path.join(__dirname, "./dist"),
			filename: "[name].[hash].js",
			chunkFilename: "[name].[chunkhash].js",
			publicPath: "../"
		},
		devServer: {
			contentBase: path.join(__dirname, "./dist"),
			historyApiFallback: true
		},
		plugins: [
			new HtmlWebpackPlugin({
				filename: "./HMS/index.html",
				// chunks: ["HMS"],
				template: "./src/HMS/HMSIndex.html"
			}),
			new webpack.ProvidePlugin(globalConfig)
		]
	}
};
